<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="dwz" uri="http://www.lyjuan.cn/dwz/tags" %>

<div class="pageContent">
	<form method="post" action="<dwz:url url="manage/relateRole"/>" class="pageForm"
          onsubmit="return validateCallback(this, customDialogAjaxDone(true, 'manage_manageList'));">
		<div class="pageFormContent" layoutH="58">
            <p>
                <label>管理员：</label>
                <input type="text" name="name" value="${user.name}" readonly />
            </p>
            <p>
                <label>角色：</label>
            </p>
            <c:forEach items="${roles}" var="list" varStatus="status">
                <c:if test="${0 == status.index % 4}">
                    <p><label>&nbsp;</label>
                </c:if>

                <input type="checkbox" name="roleIds" id="roles_${list.id}" value="${list.id}"
                       <%-- 判断是否已关联该角色 --%>
                    <c:forEach items="${userRoles}" var="userRoles">
                        <c:if test="${list.id == userRoles.id}">
                            checked
                        </c:if>
                    </c:forEach>
                >
                <span onclick="$(this).prev().click();">${list.name}</span>

                <c:if test="${0 == (status.index + 1) % 4}">
                    </p>
                </c:if>
            </c:forEach>
		</div>
		<div class="formBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">提交</button></div></div></li>
				<li><div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div></li>
			</ul>
		</div>
	</form>
</div>